package org.wat.wcy.isi.mmazur.bp.io.impl;

import java.util.List;
import java.util.Map;

import org.wat.wcy.isi.mmazur.bp.io.IBPFacade;
import org.wat.wcy.isi.mmazur.bp.io.core.Database;
import org.wat.wcy.isi.mmazur.bp.io.model.BusinessProcess;
import org.wat.wcy.isi.mmazur.bp.io.model.Node;
import org.wat.wcy.isi.mmazur.bp.io.model.enums.NodeType;
import org.wat.wcy.isi.mmazur.bp.io.model.transport.BusinessProcessMatrix;


public class BPFacadeImpl implements IBPFacade {

	@Override
	public void createModel(final String name) {
		Database.getInstance().createSchema(name);
	}

	@Override
	public void loadModel(String name, String xpdlFileName) {
		Database.getInstance().loadModel(name, xpdlFileName);
	}

	@Override
	public BusinessProcessMatrix getMatrix(String processName, boolean flat) {
		return Database.getInstance().getMatrix(processName, flat);
	}

	@Override
	public Map<String,String> getElementAdditionalData(String processId, String id) {
		return Database.getInstance().getElementAdditionalData(processId, id);
	}

	@Override
	public int getNextElementsCount(String processId, String id) {
		return Database.getInstance().getNextElementsCount(processId, id);
	}

	@Override
	public List<Node> getNextElements(String processId, int i) {
		return Database.getInstance().getNextElements(processId, i);
	}

	@Override
	public int getProcessNodesCount(String processId) {
		return Database.getInstance().getProcessNodesCount(processId);
	}

	@Override
	public int getProcessNodesCount(String processId, NodeType nodeType) {
		return Database.getInstance().getProcessNodesCount(processId, nodeType);
	}

	@Override
	public String generateXpdl(String processName) {
		return Database.getInstance().getXPDL(processName);
	}

	@Override
	public List<Node> getElementsByRole(String processId, String laneId) {
		return Database.getInstance().getElementsByRole(processId, laneId);
	}

	@Override
	public List<Node> getPrevElements(String processId, int index) {
		return Database.getInstance().getPrevElements(processId, index);
	}

	@Override
	public int getPrevElementsCount(String processId, String id) {
		return Database.getInstance().getPrevElementsCount(processId, id);
	}

	@Override
	public List<BusinessProcess> getProcesses() {
		return Database.getInstance().getProcesses();
	}

	@Override
	public List<Node> getProcessNodes(String processId) {
		return Database.getInstance().getProcessNodes(processId);
	}

	@Override
	public Node getNode(String processId, String name) {
		return Database.getInstance().getNode(processId, name);
	}

	@Override
	public boolean existsProcess(String name) {
		return Database.getInstance().existsProcess(name);
	}

	@Override
	public boolean removeProcess(String id) {
		return Database.getInstance().removeProcess(id);
	}
}